package com.sc.justification.system;

import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JDialog;
import javax.swing.JSplitPane;
import javax.swing.JScrollPane;
import javax.swing.JList;
import javax.swing.JTable;

import com.sc.justification.model.ChargeItem;
import org.jdesktop.swingbinding.JTableBinding;
import org.jdesktop.swingbinding.SwingBindings;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.BeanProperty;
import java.math.BigDecimal;
import org.jdesktop.beansbinding.ObjectProperty;

public class ChargePanel extends JPanel {
	private JTable table;
	private List<ChargeItem> chargeItems=new ArrayList<ChargeItem>();
	private JDialog dialog;

	/**
	 * Create the panel.
	 */
	public ChargePanel() {
		setLayout(new BorderLayout(0, 0));
		
		JSplitPane splitPane = new JSplitPane();
		add(splitPane, BorderLayout.CENTER);
		splitPane.setDividerLocation(200);
		JScrollPane scrollPane = new JScrollPane();
		splitPane.setLeftComponent(scrollPane);
		
		JList list = new JList();
		scrollPane.setViewportView(list);
		
		JScrollPane scrollPane_1 = new JScrollPane();
		splitPane.setRightComponent(scrollPane_1);
		
		table = new JTable();
		scrollPane_1.setViewportView(table);
		initDataBindings();
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

	}

	protected void initDataBindings() {
		JTableBinding<ChargeItem, List<ChargeItem>, JTable> jTableBinding = SwingBindings.createJTableBinding(UpdateStrategy.READ, chargeItems, table);
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty = BeanProperty.create("assistantAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty).setColumnName("助理");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_1 = BeanProperty.create("assistantFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_1).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_2 = BeanProperty.create("basePrice");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_2).setColumnName("基准价");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_3 = BeanProperty.create("editorAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_3).setColumnName("文书编辑");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_4 = BeanProperty.create("eidtorFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_4).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_5 = BeanProperty.create("firstFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_5).setColumnName("第一鉴定人");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_6 = BeanProperty.create("firstSurveyorAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_6).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, String> chargeItemBeanProperty_7 = BeanProperty.create("name");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_7).setColumnName("收费项目");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_8 = BeanProperty.create("reviewerAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_8).setColumnName("复核人");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_9 = BeanProperty.create("reviewerFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_9).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_10 = BeanProperty.create("secondFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_10).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_11 = BeanProperty.create("secondSurveyorAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_11).setColumnName("第二鉴定人");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_12 = BeanProperty.create("signerAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_12).setColumnName("签发人");
		//

		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_14 = BeanProperty.create("signerAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_14).setColumnName("签发人");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_15 = BeanProperty.create("signerFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_15).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_16 = BeanProperty.create("standardPrice");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_16).setColumnName("标准收费");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_17 = BeanProperty.create("thirdFixedOrPct");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_17).setColumnName("%/￥");
		//
		BeanProperty<ChargeItem, BigDecimal> chargeItemBeanProperty_18 = BeanProperty.create("thirdSurveyorAllowance");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_18).setColumnName("第三鉴定人");
		//
		BeanProperty<ChargeItem, Integer> chargeItemBeanProperty_19 = BeanProperty.create("unit");
		jTableBinding.addColumnBinding(chargeItemBeanProperty_19).setColumnName("单位");
	
		
		//
		jTableBinding.bind();
	}
}
